#!/bin/bash



# Distortion estimation
# [PT] **** add -noXdis and -noZdis to have AP-PA ONLY
# so, probably have to _check orientation_ OR resample before/after
3dQwarp                                                                      \
    -plusminus                                                               \
    -pmNAMES    Rev For                                                      \
    -pblur      0.05 0.05                                                    \
    -blur        -1 -1                                                       \
    -noweight                                                                \
    -minpatch   9                                                            \
    -source     EPI_AP.nii.gz                                                \
    -base       EPI_PA.nii.gz                                                \
    -overwrite                                                               \
    -noXdis  -noZdis                                                         \
    -prefix     blip_warp.nii
        

# help to reduce fat ghosts --- maybe replace this with MIN(...) 
3dcalc                                                                       \
    -overwrite                                                               \
    -prefix     EPI.nii                                             \
    -a blip_warp_For.nii                                                     \
    -b blip_warp_Rev.nii                                                     \
    -expr 'mean(a,b)'                                           

               


